const mongoose = require('mongoose');

const loginLogSchema = new mongoose.Schema({
    user: {
        type: mongoose.Schema.Types.ObjectId,
        ref: 'User',
        required: true
    },
    status: {
        type: String,
        enum: ['success', 'failed'],
        required: true
    },
    ip: {   
        type: String,
        required: true
    },
    timestamp: {
        type: Date,
        default: Date.now
    }
    }, { 
        timestamps: true 
});

const LoginLog = mongoose.model('LoginLog', loginLogSchema);

module.exports = LoginLog;
